package com.mg.jsfapp.pattern.observer.impl;

import com.mg.jsfapp.pattern.observer.IObserver;
import com.mg.jsfapp.pattern.observer.ISubject;

public class TemperatureObserver implements IObserver {

   private ISubject topic;

   @Override
   public void update() {
      Double msg = (Double) topic.getUpdate(this);
      if (msg == null) {
         System.out.println(":: No new temperatore");
      } else {
         System.out.println(":: Consuming temperatore::" + msg);
      }
   }

   @Override
   public void setSubject(ISubject sub) {
      this.topic = sub;
   }

}
